<? require("../db.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html dir="ltr" lang="EN-US">
<HEAD>
<META http-equiv="Content-Type" content="text/HTML; charset=Windows-1252">
<TITLE>Troubleshooter</TITLE>
<?
$AutoRedirect = $_POST['AutoDirect'];
if ($AutoRedirect == "") $AutoRedirect = $AutoRedirect = $_GET['AutoDirect'];
$Criteria = $_POST['Criteria'];
if ($Criteria == "") $Criteria = $_GET['Criteria'];
$TableName = $_GET["TableName"];
if ($Criteria == "") 
	{ ?>
	</HEAD>
	<BODY>
	<P> &nbsp;</P>
	<H1> BWebCentral.com Troubleshooter </H1>
	<P> &nbsp;</P>
	<P CLASS="welcome"> Welcome to the Support 
	Center. The goal of this page is to provide quick access to support tools 
        and information required to help assist you with various questions and problems
	This user guide provides conceptual information and step-by-step instructions for using the solutions on hte left</p>
	<P CLASS="welcome">
	<FORM ACTION="welcome.php">
	<TABLE>
	<INPUT TYPE=Hidden Name="TableName" Value="<? echo $_GET['TableName']; ?>">
	<TD>Search the Support Center: <INPUT Type="textbox" SIZE=30 Name="Criteria"></TD>
	<TD><INPUT TYPE="submit" Name="submit" Value ="GO!" ></TD>
	</FORM>
	</P>
	</TABLE>
	<? 
	}// end if $Criteria
else 
{
	echo "<UL><P>&nbsp;</P><FONT FACE='Arial'>";
	$NewCriteria = "";
	$Criteria = "";
	$TableName = $_GET['TableName'];
	if ($TableName == "") $TableName = "MainSupportTree";
	$L = stristr($Criteria,"*");
	$L2 = stristr ($Criteria,"?");
	if ($L1 === FALSE &&  $L2 === FALSE) $NewCriteria = "*" . $Criteria . "*";
	$SQLQ = "SELECT * FROM " . $TableName . " WHERE Keywords LIKE '" . $NewCriteria . "' OR Description LIKE '" . $NewCriteria . "' AND (Notes Is Not Null OR LinkFile Is Not Null);";
	$db = connectdb();
	$result = mysql_query($SQLQ);
	$myrow = mysql_fetch_array($result);
	if (! $myrow)
	{
	if ($AutoRedirect == "1")  
		{
		header("Location: http://www.google.com/search?q=$Criteria");
		die();
		}
	?>

	<P> &nbsp;</P>
	<H1> Support Troubleshooter </H1>
	<P> &nbsp;</P>
	<P CLASS="welcome"> Welcome to the Support 
        Center. The goal of this page is to provide quick access to support tools 
        and information required to help assist you with your system's performance

	This user guide provides conceptual information and step-by-step instructions for using the solutions to the right.</p>
	<P CLASS="welcome">
	<FORM ACTION="welcome.php">
	<TABLE>
	<INPUT TYPE=Hidden Name="TableName" Value="<% Response.Write (Request.QueryString("TableName")) %>">
	<TD>Search the Support Center: <INPUT Type="textbox" SIZE=30 Name="Criteria"></TD>
	<TD><INPUT TYPE="submit" Name="submit" Value ="GO!" ></TD>
	</FORM>
	</P>
	</TABLE>

	<?
	
	echo "<P>Sorry, No records found matching: $Criteria";
	}

else
{
	if (count($myrow) == 1 &&  $AutoRedirect == "1" &&  ! is_null($myrow["LinkFile"]))
	{
		$Loc = $myrow["LinkFile"];
		die();
	}

	While ($myrow)
		{
		if (! is_null($myrow["Notes"])) 
			{
			$TheURL = "shownote.php?TableName=" . $TableName . "&NoteID=" .  $myrow["SupportID"];
			}		
		elseif (!is_null($myrow["LinkFile"])) 
		{
		$TheURL = $myrow["LinkFile"];
		}?>
	
		<LI><A HREF="<? echo $TheURL; ?>"> <? echo $myrow["Description"]; ?> </A>

		</LI>
		<?
		$myrow = mysql_fetch_array($result);
		}
}
}
?>

</UL>
</BODY>
</HTML>
